home *** CD-ROM | disk | FTP | other *** search
/ MacWarehouse Macintosh Games / MacWarehouse Macintosh Games.iso / AMBER demo / ROXY / ROXY.dxr / 02739_spared list.ls < prev    next >
Encoding:
Text File  |  1996-10-18  |  1.7 KB  |  61 lines

  1. on deflateMe
  2.   set lsSparedList to value(field "spared list")
  3.   put lsSparedList
  4.   if not listp(lsSparedList) then
  5.     alert("Sorry, there was an error creating the spared list")
  6.     exit
  7.   else
  8.     put "<i> spared list created with " & count(lsSparedList) & " members."
  9.   end if
  10.   set howManyMembers to the number of castMembers
  11.   put "<i> howManyMembers = " & howManyMembers
  12.   set the itemDelimiter to ":"
  13.   repeat with cNum = 1 to howManyMembers
  14.     if the mouseDown then
  15.       exit
  16.     end if
  17.     if the castType of cast cNum = #bitmap then
  18.       set myLinkName to the last item in the fileName of cast cNum
  19.       put myLinkName
  20.       if (getPos(lsSparedList, myLinkName) = 0) and (myLinkName <> EMPTY) then
  21.         put "  " & cNum & " is a goner..."
  22.         erase(cast cNum)
  23.         next repeat
  24.       end if
  25.       put "sparing cast " & cNum & ": " & the name of cast cNum
  26.     end if
  27.   end repeat
  28.   set the itemDelimiter to ","
  29.   set oldFileName to the movieName
  30.   set newFileName to "tiny " & oldFileName
  31.   put "<i> saving as " & newFileName
  32.   saveMovie(newFileName)
  33. end
  34.  
  35. on generateSparedList
  36.   set temp to FileIO(mnew, "?read", "PICT")
  37.   put temp
  38.   if not objectp(temp) then
  39.     alert("Sorry, error finding file: " & FileIO(mError, temp))
  40.     exit
  41.   end if
  42.   set targetPath to temp(mFileName)
  43.   put targetPath
  44.   set oldDelim to the itemDelimiter
  45.   set the itemDelimiter to ":"
  46.   delete char -30002 of targetPath
  47.   put "trimmed targetPath ="
  48.   put targetPath
  49.   set the itemDelimiter to oldDelim
  50.   temp(mdispose)
  51.   set sparedList to []
  52.   repeat with fNum = 1 to the maxinteger
  53.     set fName to getNthFileNameInFolder(targetPath, fNum)
  54.     if fName = EMPTY then
  55.       exit repeat
  56.     end if
  57.     append(sparedList, fName)
  58.   end repeat
  59.   return sparedList
  60. end
  61.